<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script type="text/javascript" src="js/jsAddress.js"></script>
  <title>e网批发管理后台</title>
  <?php include("common/conn.php");  

  if($_GET['action']=="ok")
  {   
    if ($_REQUEST[name_ext]==0) {
      $name=$_REQUEST[name]."快递";
    }elseif ($_REQUEST[name_ext]==1) {
      $name=$_REQUEST[name]."物流";
    }else{
      $name=$_REQUEST[name];
    }
    $srat=mysql_query("INSERT INTO express_delivery(name) VALUES ('$name')");
// 调用接口生产拼音
    $url="http://localhost/zcz/xzpf/api/pinyin/index.php";
    file_get_contents($url);
// 调用接口生产拼音 end
    echo "<script>window.location.href='express.php';</script>";
  }


  if($_GET['ch']=="ok")
  {   
    if ($_REQUEST[name_ext]==0) {
      $name=$_REQUEST[name]."快递";
    }elseif ($_REQUEST[name_ext]==1) {
      $name=$_REQUEST[name]."物流";
    }else{
      $name=$_REQUEST[name];
    }
    mysql_query("UPDATE express_delivery SET name='".$name."' where id='".$_REQUEST['id']."'");
// 调用接口生产拼音
    $url="http://localhost/zcz/xzpf/api/pinyin/index.php";
    file_get_contents($url);
// 调用接口生产拼音 end
    echo "<script>window.location.href='express.php';</script>";
  }
  if ($_GET[id]!='') {
    $query=mysql_query("select * from express_delivery where id=".$_GET[id]);
    $express=mysql_fetch_assoc($query);
    if (strstr($express[name], '快递')!=false) {
      $name = explode('快递',$express[name]);
      $name_ext=0;
    }elseif (strstr($express[name], '物流')!=false) {
      $name = explode('物流',$express[name]);
      $name_ext=1;
    }else{
      $name[0]=$express[name];
      $name_ext=2;
    }
  }

  ?>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <link href="css/styles.css" rel="stylesheet" type="text/css" />
  <link href="css/style2.css" rel="stylesheet" type="text/css" />
  <script type="text/JavaScript">
    <!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>

  <!--header-->
  <?php include("common/header.php");?>
  <!--header end-->
  <div id="sub_nav">

    <div id="subnav_wrap" class="container_12">



    </div>


  </div>

  <div class="container_12">
    <form action="?<?php if($_GET['id']!=""){echo "ch=ok";}else{echo "action=ok";} ?>" method="post" enctype="multipart/form-data"> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="10%" scope="col"></td>
          <td width="40%" scope="col"><label>快递公司名称</label></td>
          <td width="50%" scope="col">
            <input name="name" type="text" class="text"  value="<?php echo $name[0];?>"/>
            <select name="name_ext" class="select">
              <option value="0" <?php if ($name_ext==0) {?> selected <?php } ?>>快递</option>
              <option value="1" <?php if ($name_ext==1) {?> selected <?php } ?>>物流</option>
              <option value="2" <?php if ($name_ext==2) {?> selected <?php } ?>></option>
            </select>
          </td>
        </tr>
        <tr>
          <td width="10%" scope="col"></td>
          <td width="40%" scope="col"></td>
          <td width="50%" scope="col"><input name="id" type="hidden" value="<?php echo $_GET[id];?>" />
            <input name="" type="submit" value="提交" class="submit" /></td>
          </tr>
        </table>
      </form>
    </div>

  </form>


</body>
</html>
